home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
-
- ###############################################################################
-
- #
- # Save the invocvation name, invocation directory, and command name.
- #
- invoke=$0
-
- invoke_directory=`dirname $invoke`
- command=`basename $invoke`
-
- #
- # Set PWD to current directory.
- #
- PWD=`pwd`
-
- #
- # Get current architecture and OS name.
- #
- case "`uname -s`" in
- AIX)
- architecture="aix"
- ;;
-
- HP-UX)
- architecture="hpuxpa"
- ;;
-
- IRIX)
- architecture="irix5m"
- ;;
-
- IRIX64)
- architecture="irix5m"
- ;;
-
- IRIX32)
- architecture="irix5m"
- ;;
-
- OSF1)
- architecture="decosfa"
- ;;
-
- SunOS)
- OSversion=`uname -r`
- first=`expr "$OSversion" : '\(.\)'`
-
- if [ "$first" = "5" ]; then
- first=`uname -p`
- archletter=`expr "$first" : '\(.\)'`
-
- architecture="sunos5$archletter"
- else
- architecture="sunos4"
- fi
- ;;
-
- UNIX_SV)
- if [ "`uname -m`" = "R4000" ]; then
- architecture="uw2i"
- else
- architecture="ews"
- fi
- ;;
-
- *)
- ;;
- esac
-
- #
- # Get position of first '/' in pathname to determine whether command was run
- # with an absolute pathname.
- #
- first=`expr "$invoke" : '\(.\)'`
-
- #
- # If command pathname begins with '/' then it's already fully qualified.
- #
- if [ "$first" = "/" ]; then
- directory=$invoke_directory/../$architecture/bin
- #
- # Otherwise it must be relative to the current directory.
- #
- else
- #
- # Don't include $invoke_directory in pathname if it is ".".
- #
- if [ "$invoke_directory" = "." ]; then
- directory=$PWD/../$architecture/bin
- else
- directory=$PWD/$invoke_directory/../$architecture/bin
- fi
- fi
-
- #
- # Make sure we found the command directory.
- #
- if [ -z "$directory" ]; then
- echo "Can't figure out how to run $invoke. Please re-run with full pathname." 1>&2
- exit 1
- fi
-
- #
- # Set wd to be the command directory without the architecture suffix (for error messages).
- #
- wd=`dirname $directory`
-
- if [ "$wd" = "." ]; then
- wd=$PWD
- fi
-
- #
- # If there is no directory for the architecture or the command does not exist, inform the user.
- #
- if [ ! -d $directory ]; then
- echo "Unable to execute the command $command installed in $wd." 1>&2
- echo "No software in this directory has been installed for the $architecture architecture." 1>&2
- exit 1
- elif [ ! -f $directory/$command ]; then
- echo "The command $command located in $wd has not been installed for the $architecture architecture." 1>&2
- exit 1
- fi
-
- if [ "$architecture" = "aix" ]; then
- LIBPATH=$directory/../lib:$LIBPATH
- export LIBPATH
- elif [ "$architecture" = "hpuxpa" ]; then
- SHLIB_PATH=$directory/../lib:$SHLIB_PATH
- export SHLIB_PATH
- else
- LD_LIBRARY_PATH=$directory/../lib:$LD_LIBRARY_PATH
- export LD_LIBRARY_PATH
- fi
-
- exec $directory/$command "$@"
-